home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / dosutils / tsbat50.zip / PUSHDIRE.BAT < prev    next >
DOS Batch File  |  1993-02-13  |  2KB  |  46 lines

  1. @echo off
  2. echo ┌─────────────────────────────────────────────────────────┐
  3. echo │ Nonresident pushdir (Stores the current directory name) │
  4. echo │ By Prof. Timo Salmi, ts@uwasa.fi, Sat 13-Feb-1993       │
  5. echo └─────────────────────────────────────────────────────────┘
  6.  
  7. rem Saves the current drive and directory names in pushdriv and
  8. rem pushdire environment variables.
  9.  
  10. rem After changing directory, you can pop back to the original
  11. rem drive and directory by applying POPDIRE.BAT.
  12.  
  13. rem usage PUSHDIRE [/s]
  14. rem  /s is for show, that is the environment variables are echoed
  15.  
  16. rem If you get an "Out of environment space" message, increase your
  17. rem environment space by using shell configuration in config.sys:
  18. rem Example: shell=c:\bin\command.com /e:1024 /p
  19.  
  20. rem Store the current directory name into pushdire environment variable
  21. echo @echo off> director.bat
  22. echo set pushdire=%%2>> director.bat
  23. dir | find "Directory"> go.bat
  24. call go
  25. if exist director.bat del director.bat
  26. if exist go.bat del go.bat
  27.  
  28. rem Store the current drive name into pushdire environment variable
  29. cd \
  30. echo @echo off> director.bat
  31. echo set pushdriv=%%2>> director.bat
  32. dir | find "Directory"> go.bat
  33. call go
  34. if exist director.bat del director.bat
  35. if exist go.bat del go.bat
  36.  
  37. rem Restore the original directory
  38. cd %pushdire%
  39.  
  40. rem Show if asked
  41. for %%s in (s S) do if "%1"=="/%%s" echo Pushed directory %pushdire%
  42. for %%s in (s S) do if "%1"=="/%%s" echo Pushed drive     %pushdriv%
  43.  
  44. :_out
  45. echo on
  46.